package pl.edu.agh.iosr.gamblingzone.dao;

import java.io.Serializable;
import java.util.List;

import javax.persistence.EntityManager;

/**
 * The Interface GenericDAO.
 */
public interface GenericDAO<T, ID extends Serializable> {

    /**
     * Find by id.
     * 
     * @param id the id
     * @param lock the lock
     * 
     * @return the t
     */
    T findById(ID id, boolean lock);

    /**
     * Find all.
     * 
     * @return the list< t>
     */
    List<T> findAll();
    
    /**
     * Find all elements and returns given page of data.
     * 
     * @param page the page
     * 
     * @return the list< t>
     */
    List<T> findAll(int page);
    
    
    /**
     * Gets the entities count.
     * 
     * @return the entities count
     */
    int getEntitiesCount();
    
    /**
     * Gets the page count.
     * 
     * @return the page count
     */
    public int getPageCount();
    
    /**
     * Sets the page size.
     * 
     * @param pageSize the new page size
     */
    public void setPageSize(int pageSize);
    
    /**
     * Gets the page size.
     * 
     * @return the page size
     */
    public int getPageSize();

    /**
     * Make persistent.
     * 
     * @param entity the entity
     * 
     * @return the t
     */
    T makePersistent(T entity);

    /**
     * Make transient.
     * 
     * @param entity the entity
     */
    void makeTransient(T entity);

    /**
     * Sets the entity manager.
     * 
     * @param entityManager the new entity manager
     */
    public void setEntityManager(EntityManager entityManager);
}